# Copyright (C) 2018-2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#

set(OpenVINO_MAIN_SOURCE_DIR "@OpenVINO_SOURCE_DIR@")
set(IE_MAIN_SOURCE_DIR "@InferenceEngine_SOURCE_DIR@")

file(TO_CMAKE_PATH "${CMAKE_CURRENT_LIST_DIR}" cache_path)

# Variables to export in plugin's projects

set(ie_options "@IE_OPTIONS@;CMAKE_BUILD_TYPE;CMAKE_SKIP_RPATH")

foreach(option IN LISTS ie_options)
    if(NOT DEFINED "${option}")
        load_cache("${cache_path}" READ_WITH_PREFIX "" ${option})
     endif()
endforeach()

message(STATUS "The following CMake options are exported from Inference Engine Developer package")
message("")
foreach(option IN LISTS ie_options)
    message("    ${option}: ${${option}}")
endforeach()
message("")

set(gflags_DIR "@gflags_BINARY_DIR@")
# GNA lib dir
set(GNA "@GNA@")

# Targets

include("${CMAKE_CURRENT_LIST_DIR}/targets_developer.cmake")

# to allow too create ALIAS for IE::inference_engine in 3rd-party projects
set_property(TARGET IE::inference_engine PROPERTY IMPORTED_GLOBAL TRUE)

get_target_property(InferenceEngine_INCLUDE_DIRS IE::inference_engine INTERFACE_INCLUDE_DIRECTORIES)
set(InferenceEngine_LIBRARIES IE::inference_engine)

#
# Common cmake includes
#

list(APPEND CMAKE_MODULE_PATH "${OpenVINO_MAIN_SOURCE_DIR}/cmake")
list(APPEND CMAKE_MODULE_PATH "${IE_MAIN_SOURCE_DIR}/cmake")

# generic stuff from developer package
include(developer_package NO_POLICY_SCOPE)
include(developer_package_ie)

# Don't threat deprecated API warnings as errors in 3rd party apps
ie_deprecated_no_errors()

# inherit OpenCV from main IE project if enabled
if (ENABLE_OPENCV)
    load_cache("${cache_path}" READ_WITH_PREFIX "" OpenCV_DIR)
    find_package(OpenCV)
endif()

# inherit TBB from main IE project if enabled
if (THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO")
    load_cache("${cache_path}" READ_WITH_PREFIX "" TBB_DIR)
    find_package(TBB)
endif()

find_package(Threads REQUIRED)
